<template>
  <el-dialog
    title="分配角色"
    :visible.sync="state"
    width="30%"
    :before-close="handleClose">
    <!-- dialog内容 -->
    <qf-form
      width="80px"
      :formConfig="formConfig"
      :formBtns="formBtns"
      @submit="submitFn">
    </qf-form>

    <!-- dialog内容 end -->
  </el-dialog>
</template>

<script>
export default {
  props: {
    state: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // 表单配置
      formConfig: [
        {
          label: '当前用户',
          field: 'uname',
          disabled: true,
          type: 'text',
          rules: []
        },
        {
          label: '当前角色',
          field: 'role_name',
          disabled: true,
          type: 'text',
          rules: []
        },
        {
          label: '选择角色',
          field: 'role_id',
          type: 'select',
          payload: [
            {
              label: '超级管理员',
              value: 1
            },
            {
              label: '财务',
              value: 2
            },
            {
              label: '人事',
              value: 3
            },
            {
              label: '普通用户',
              value: 4
            }
          ],
          rules: [{ required: true, message: '请选择角色', trigger: 'blur' }]
        }
      ],
      formBtns: [
        {
          content: '更新',
          width: '205px',
          type: 'primary'
        }
        // {
        //   content: '取消',
        //   type: ''
        // }
      ]
    };
  },

  methods: {
    handleClose() {
      this.$emit('close');
    },
    submitFn(formData) {
      console.log('更新数据处理', formData);
    }
  }
};
</script>

<style></style>
